/*
 * Peralta Santa Anna Victor Miguel
 * Diciembre 2011
 * Stored Procedure:
 *
 * Borramos la información de una Vacante
 */

CREATE OR REPLACE FUNCTION deleteVacante
	(
		nIdVacante1					INTEGER
		
	) RETURNS INTEGER AS $$
	
	BEGIN
	
		DELETE FROM EMPRESAVACANTES
		
		WHERE nIdVacante = nIdVacante1;
	
		DELETE FROM VACANTES 
		
		WHERE nIdVacante = nIdVacante1;
		
		DELETE FROM POSTULADOS
		
		WHERE nIdVacante = nIdVacante1;
		
		RETURN 1;
		
		COMMIT;
		
	END;
	
$$ LANGUAGE plpgsql;

--select deleteVacante( 3 );

